<?php

/*
 * This file is part of the Geek-Zoo Projects.
 *
 * @copyright (c) 2010 Geek-Zoo Projects More info http://www.geek-zoo.com
 * @license http://opensource.org/licenses/gpl-2.0.php The GNU General Public License
 * @author xuanyan <xuanyan@geek-zoo.com>
 *
 */
require_once ROOT_PATH.'/Abstract/front_abstract.php';

class Action extends front_abstract
{
    function index()
    {
		// print_r($this->api->home_timeline($this->access_token));
         if ($id = _GET('id')) {
            if ($info = _model('user')->read(array('account_id'=>$id))) {
                unset($info['password']);
                
                if ($id == @$_SESSION['append_user']['id']) {
                    unset($_SESSION['append_user']);
                    $_SESSION['user'] = $info;
                } elseif ($info['parent_id'] == $_SESSION['user']['id']) {
                    if (empty($_SESSION['append_user'])) {
                        $_SESSION['append_user'] = $this->weibo_info;
                    }
                    $_SESSION['user'] = $info;
                } else {
                    $ids = explode(',', $_SESSION['user']['accounts']);
                    if (in_array($id, $ids)) {
                        if (empty($_SESSION['append_user'])) {
                            $_SESSION['append_user'] = $this->weibo_info;
                        }
                        $_SESSION['user'] = $info;
                    }
                }
                

            }

            $this->redirect('index.html');
         }
         $this->smarty->display('index.html');
    }
}


?>